package com.example.administrator.maizuofilm;

import android.app.Application;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.backends.okhttp3.OkHttpImagePipelineConfigFactory;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.facebook.imagepipeline.decoder.ProgressiveJpegConfig;
import com.facebook.imagepipeline.image.ImmutableQualityInfo;
import com.facebook.imagepipeline.image.QualityInfo;

import okhttp3.OkHttpClient;

public class MyApplication extends Application {

  private  static  final String CNAME="北京";
  private   static  final  String CID="12";
    
	private   String  CityName;
	private     String  CityId;
	
	@Override
    public void onCreate() {
    	super.onCreate();
    	setCityName(CNAME);
    	setCityId(CID);
		OkHttpClient client = new OkHttpClient();
		//渐进式加载
		ProgressiveJpegConfig pjpegConfig = new ProgressiveJpegConfig() {
			@Override
			public int getNextScanNumberToDecode(int scanNumber) {
				return scanNumber + 2;
			}

			public QualityInfo getQualityInfo(int scanNumber) {
				boolean isGoodEnough = (scanNumber >= 5);
				return ImmutableQualityInfo.of(scanNumber, isGoodEnough, false);
			}
		};
		//此处初始化fresco
		ImagePipelineConfig config = OkHttpImagePipelineConfigFactory.newBuilder(this, client)
				.setProgressiveJpegConfig(pjpegConfig)
				.build();
		Fresco.initialize(this, config);
    }
	public String getCityName() {
		return CityName;
	}

	public void setCityName(String cityName) {
		CityName = cityName;
	}

	public String getCityId() {
		return CityId;
	}

	public void setCityId(String cityId) {
		CityId = cityId;
	}

	


	
}
